//
// Created by jsjxsy on 2022/9/1.
// c++ primer plus 14.3 练习
//
#include <iostream>
#include <cstring>
using namespace std;
class Frabjous {
 private:
  char fab[20];
 public:
  Frabjous(const char *s = "C++") {
    strcpy(fab, s);
  }
  virtual void tell() { cout << fab; }
};
class Gloam : private Frabjous {
 private:
  int glip;
  Frabjous fb;
 public:
  Gloam(int g = 0, const char *s = "C++");
  Gloam(int g, const Frabjous &f);
  void tell();
};
Gloam::Gloam(int g, const Frabjous &f) {
  glip = g;
  fb = f;
}

Gloam::Gloam(int g, const char *s) {
  glip = g;
  fb = Frabjous(s);
}

void Gloam::tell() {
  cout << glip << " ";
//  Frabjous::tell();
  fb.tell();
  cout << endl;
}

int main() {
  Gloam g;
  g.tell();

  Frabjous f("java");
  f.tell();

  Gloam g2(1, f);
  g2.tell();

  Gloam h;
  h = g2;
  h.tell();
  return 0;
}